import micropython

class BootGuard:
    AutoBoot = const(1)

class HAL:

    def GetPlatform():
        import sys

        return sys.platform

    def GetCPU():
        import machine

        return f'generic.{HAL.GetPlatform()} @ {machine.freq() // 1_000_000} MHz'
    
    def CheckRAM():
        return f'{gc.mem_free()} Bytes of RAM OK'

    def Setup():
        import micropython

        micropython.alloc_emergency_exception_buf(256)

BOOTGUARD_VERSION = "0.1"
BOOTGUARD_BOOT_MODE = BootGuard.AutoBoot

WELCOME = f"""

BootGuard v{BOOTGUARD_VERSION}

{HAL.GetCPU()}
{HAL.CheckRAM()}
"""
